package me.leiusual.sharing.repository.datasource

import androidx.lifecycle.MutableLiveData
import androidx.paging.DataSource
import me.leiusual.sharing.api.ApiSharing
import me.leiusual.sharing.api.model.UserAccountLog

/**
 * author: leiusual
 * create on: 2019-08-06
 * description:
 */
class UserAccountDataSourceFactory(
    private val apiSharing: ApiSharing,
    private val id: Long
) : DataSource.Factory<Int, UserAccountLog>() {

  val userAccountDataSource = MutableLiveData<UserAccountDataSource>()

  override fun create(): DataSource<Int, UserAccountLog> {
    val dataSource = UserAccountDataSource(apiSharing, id)
    userAccountDataSource.postValue(dataSource)
    return dataSource
  }
}